package service.impl;

import dao.OrderDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import po.Order;
import service.OrderService;

import java.util.List;

@Service
@Transactional
public class OrderServiceImpl implements OrderService {
    // 注解注入 OrderDao
    @Autowired
    private OrderDao orderDao;
    //  查询条件带状态
    @Override
    public List<Order> allOrder(Order order, String status) {
        return this.orderDao.allOrder(order,status);
    }

    @Override
    public int addOrder(Order order) {
        // 返回插入的主键
        this.orderDao.addOrder(order);
//        System.out.println(order.getId()+"插入的id 111111111111111111111111111");
        return order.getId();
    }

    @Override
    public Boolean deleteOrder(Integer id) {
        return this.orderDao.deleteOrder(id) > 0;
    }

    @Override
    public Boolean deleteOrderOfPayment(Integer id) {
        return this.orderDao.deleteOrderOfPayment(id)>0;
    }

    @Override
    public Boolean editTotolMoney(Order order) {
        return this.orderDao.editTotolMoney(order) > 0;
    }

    @Override
    public Order orderOfId(Integer id) {
        return this.orderDao.orderOfId(id);
    }

    @Override
    public Boolean editOrder(Order order) {
        return this.orderDao.editOrder(order) > 0;
    }

    @Override
    public List<Order> allOrderChart(Order order) {
        return this.orderDao.allOrderChart(order);
    }
}
